using UnityEngine;
using System.Collections;

public class pickupScript : MonoBehaviour {
	public int life = 0;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		life+=1;
		if(life>1){
			GameObject.Destroy(gameObject);
		}
	}
	void OnTriggerEnter(Collider other){
		fireballP f = other.GetComponent<fireballP>();
		if(f != null){
			print(transform.parent.name);
			transform.parent.GetComponent<PlayerScript>().weaponT(1);
			f.death();
		}
		spinP p = other.GetComponent<spinP>();
		if(p != null){
			transform.parent.GetComponent<PlayerScript>().weaponT(0);
			p.death();
		}
		waterPickup w = other.GetComponent<waterPickup>();
		if(w != null){
			transform.parent.GetComponent<PlayerScript>().weaponT(2);
			GameObject.Destroy(other.gameObject);
		}
	}
	public void setParent(Transform par){
		transform.parent = par;
	}
}
